package cn.edu.hunau.oop.day02.constract;

import org.junit.Test;

/**
 * @author hb
 * @date 2025-08-05 15:32:20
 */
public class ExtendConstract {

    @Test
    public  void test(){
        Coo coo=new Coo();
        System.out.println("------------");
        Coo c2 = new Coo("测试");
    }
}

class Poo{
   public Poo( ){
       System.out.println("Poo无参数构造器");
   }
}

class Coo extends Poo{
   public Coo(){
       super();//通常可以省略,在编译时添加.
       System.out.println("Coo无参数构造器");
   }

    public Coo(String data){
        System.out.println("Coo有参数构造器");
    }
}


class Goo{
    public Goo(String data){
        System.out.println("Goo有参数构造器");
    }
}

class Foo extends Goo{
    public Foo(){
        super("实参");//必须明确提供
        System.out.println("Foo无参数构造器");
    }
}